package com.old.people.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.old.people.entities.Appraisal;
import com.old.people.entities.Disease;
import com.old.people.entities.Funds;
import com.old.people.entities.OrderOldPeople;
import com.old.people.entities.Service;
import com.old.people.entities.Servicer;
import com.old.people.service.ServicerServices;
import com.old.people.util.ShortChainUtils;

@RestController
public class ServicerController {
	@Autowired
	private ServicerServices servicerServices;
	
	@RequestMapping("/consumer/getService")
	@ResponseBody
	List<Service> getService(String account_id){
		return servicerServices.getService("165");
	}
	
	@RequestMapping("/consumer/updateService")
	@ResponseBody
	public boolean updateService(String service_id, String service_name, String service_content, String service_price,
			String service_type) {
		return servicerServices.updateService(service_id, service_name, service_content, service_price, service_type);
	}
	
	@RequestMapping("/consumer/insertService")
	@ResponseBody
	public boolean insertService(String account_id,String service_name, String service_content, String service_price,
			String service_type) {
		String service_id=ShortChainUtils.getString();
		return servicerServices.insertService(account_id,service_id, service_name, service_content, service_price, service_type);
	}
	
	@RequestMapping("/consumer/getServicer")
	@ResponseBody
	public Servicer getServicer(String account_id) {
		return servicerServices.getServicer(account_id);// 获取服务人员信息

	}
	
	@RequestMapping("/consumer/updateServicers")
	@ResponseBody
	public boolean updateServicers(String servicer_id,String servicer_name,String servicer_sex,String servicer_tel,String servicer_idcard) {
		return servicerServices.updateServicers(servicer_id, servicer_name, servicer_sex, servicer_tel, servicer_idcard);
	}
	
	
	@RequestMapping("/consumer/getOrderOldPeople")
	@ResponseBody
	public List<OrderOldPeople> getOrderOldPeople(String account_id, int page) {
		return servicerServices.getOrderOldPeople(account_id, page);
	}
//	@RequestMapping("/consumer/getOrderOldPeople")
//	@ResponseBody
//	public List<OrderOldPeople> getOrderOldPeople() {
//		return servicerServices.getOrderOldPeople("165", 1);
//	}
	
	@RequestMapping("/consumer/getOrderOldPeopleSum")
	@ResponseBody
	public int getOrderOldPeopleSum(String account_id) {
		return servicerServices.getOrderOldPeopleSum(account_id);
	}
	
	@RequestMapping("/consumer/getDisease")
	@ResponseBody
	public List<Disease> getDisease(String oldpeople_id) {

		return servicerServices.getDisease(oldpeople_id);
	}

	@RequestMapping("/consumer/updateDisease")
	@ResponseBody
	public boolean updateDisease(String disease_id, String disease_parameter) {

		return servicerServices.updateDisease(disease_id, disease_parameter);
	}

	@RequestMapping("/consumer/insertDisease")
	@ResponseBody
	public boolean insertDisease(String disease_name, String disease_parameter,
			String oldpeople_id) {
		String disease_id=ShortChainUtils.getString();
		return servicerServices.insertDisease(disease_id, disease_name, disease_parameter, oldpeople_id);
	}
	
	
	
	
	@RequestMapping("/consumer/getAppraisalpage")
	@ResponseBody
	public int getAppraisalpage(String account_id) {
		return servicerServices.getAppraisalpage(account_id);
	}

	@RequestMapping("/consumer/getAppraisal")
	@ResponseBody
	public List<Appraisal> getAppraisal(String account_id,int page) {
		return servicerServices.getAppraisal(account_id, page);
	}
	
	@RequestMapping("/consumer/getFundsPage")
	@ResponseBody
	public int getFundsPage(String account_id) {
		return servicerServices.getFundsPage(account_id);
	}
	
	@RequestMapping("/consumer/getFunds")
	@ResponseBody
	public List<Funds> getFunds(String account_id, int page) {
		return servicerServices.getFunds(account_id, page);
	}
}
